package org.nulldevice.tankshot.ai;

import java.util.ArrayList;
import java.util.Random;

import org.nulldevice.tankshot.Game;

public class BasicAI extends AI {

	Random randomGenerator;
	int direction;
	
	@Override
	public void init() {
		speedFactor = 1;
		randomGenerator = new Random();
		targets = new ArrayList<Target>();
		for (int i = 0; i < distanceToWalls.length; i++)
			distanceToWalls[i] = radius;
		direction=Game.DIRECTION_UP;
	}

	@Override
	public void prepareMove() {
		// TODO the AI does not know how to drive, insert that here
		if (randomGenerator.nextInt(400) == 0){
			direction=Game.DIRECTION_UP;
		}
		if (randomGenerator.nextInt(400) == 1){
			direction=Game.DIRECTION_DOWN;
		}
			
		owner.setDirection(direction);

		getTargets();

		// Attention: The AI is now deadly ;-)
		if (randomGenerator.nextInt(100) == 0)
			owner.shoot();
	}

}
